import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUploadStore = defineStore('upload', () => {
  const uploadHistory = ref<Array<{
    id: number
    originalUrl: string
    colorizedUrl: string
    fileName: string
    time: string
  }>>([])

  const addHistory = (item: {
    originalUrl: string
    colorizedUrl: string
    fileName: string
  }) => {
    uploadHistory.value.unshift({
      id: Date.now(),
      time: new Date().toLocaleString(),
      ...item
    })
  }

  return {
    uploadHistory,
    addHistory
  }
}) 